package a.j;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.q;
import a.c.y;
import a.f.wc;
import a.i.x;
import a.j.a.b;
import a.j.a.j;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.geom.Rectangle2D;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Map;

public class cc
{
  public static final byte a = 0;
  public static final byte b = 1;
  public static final byte c = 2;
  private g d;
  private x.a_ e;
  private PropertyChangeSupport f = new PropertyChangeSupport(this);
  private df g;
  private g_ h;
  private f_ i;
  private e_ j;
  private ke.d_ k;
  private PropertyChangeListener l;
  private cf m;
  private boolean n = true;
  private boolean o = true;
  private ze p;
  private j q;
  private byte r;
  public static boolean s;
  
  public cc(df paramdf)
  {
    this.g = paramdf;
    this.k = new ke.d_()
    {
      public void a(g paramAnonymousg)
      {
        cc.this.k();
      }
    };
    c(e());
    this.p = this.g.e();
    this.l = new PropertyChangeListener()
    {
      public void propertyChange(PropertyChangeEvent paramAnonymousPropertyChangeEvent)
      {
        boolean bool = ld.E;
        if ((bool) || ("Graph2D".equals(paramAnonymousPropertyChangeEvent.getPropertyName())))
        {
          g localg1 = (g)paramAnonymousPropertyChangeEvent.getOldValue();
          g localg2 = (g)paramAnonymousPropertyChangeEvent.getNewValue();
          if (!bool)
          {
            if (localg1 != null) {
              cc.this.a(localg1);
            }
            cc.this.c(localg2);
          }
          cc.this.k();
        }
      }
    };
    b(this.p);
    this.m = new cf()
    {
      public void a(ze paramAnonymousze)
      {
        if (!ld.E) {
          if (cc.this.o)
          {
            cc.this.a(cc.this.p);
            cc.this.b(paramAnonymousze);
          }
        }
        cc.this.p = paramAnonymousze;
      }
    };
    this.g.a(this.m);
  }
  
  public x.a_ a()
  {
    return this.e;
  }
  
  public void a(x.a_ parama_)
  {
    this.e = parama_;
  }
  
  protected q b()
  {
    return this.d;
  }
  
  public boolean c()
  {
    boolean bool = ld.E;
    if ((bool) || (this.d != null)) {
      if (bool) {
        break label30;
      }
    }
    label30:
    return this.d.n();
  }
  
  public boolean d()
  {
    return this.n;
  }
  
  public void a(q paramq, a.c.w paramw)
  {
    boolean bool2 = ld.E;
    if ((bool2) || (paramw.e()))
    {
      boolean bool1 = c();
      if (!bool2) {
        if (this.q != null)
        {
          this.q.j().o();
          this.q.a();
          this.q = null;
        }
      }
      j localj = j.a(paramq);
      if (localj != null)
      {
        Object localObject = a(paramq).a();
        if (!bool2)
        {
          if (!(localObject instanceof g)) {
            localObject = new g();
          }
          this.q = ((g)localObject).K();
        }
        if (!bool2) {
          if (this.q == null)
          {
            this.q = new j((q)localObject);
            this.q.a(localj.b());
          }
        }
        this.d = ((g)this.q.j());
        if (bool2) {
          break label211;
        }
        if (!ld.D) {}
      }
      else
      {
        this.d = ((g)a(paramq).a());
      }
      if (!bool2)
      {
        a(paramq, this.d, paramw);
        label211:
        if (bool1 == c()) {}
      }
      else
      {
        if (!bool2) {}
        this.f.firePropertyChange("empty", bool1, !bool1);
      }
    }
  }
  
  protected x.a_ a(q paramq)
  {
    x.a_ locala_ = a();
    if (!ld.E) {}
    return locala_ != null ? locala_ : paramq.e();
  }
  
  protected g e()
  {
    return this.g.e().a();
  }
  
  protected bb a(q paramq1, q paramq2, a.c.w paramw)
  {
    x.a_ locala_ = a(paramq2);
    x.a_ local2 = new x.a_()
    {
      private final x.a_ val$innerFactory;
      
      public e a(q paramAnonymousq, e paramAnonymouse)
      {
        return cc.this.b(paramAnonymousq, paramAnonymouse);
      }
      
      public d a(q paramAnonymousq, e paramAnonymouse1, e paramAnonymouse2, d paramAnonymousd)
      {
        return cc.this.a(paramAnonymousq, paramAnonymouse1, paramAnonymouse2, paramAnonymousd);
      }
      
      public q a()
      {
        return this.val$innerFactory.a();
      }
      
      public void a(q paramAnonymousq1, q paramAnonymousq2)
      {
        this.val$innerFactory.a(paramAnonymousq1, paramAnonymousq2);
      }
      
      public void a(q paramAnonymousq1, q paramAnonymousq2, Map paramAnonymousMap1, Map paramAnonymousMap2)
      {
        this.val$innerFactory.a(paramAnonymousq1, paramAnonymousq2, paramAnonymousMap1, paramAnonymousMap2);
      }
    };
    dc.a_ locala_1 = new dc.a_(local2);
    x localx = new x(locala_1);
    locala_1.a(localx);
    paramq2.z();
    try
    {
      bb localbb = localx.a(paramq1, paramw, paramq2);
      return localbb;
    }
    finally
    {
      paramq2.A();
    }
  }
  
  public bb a(q paramq, double paramDouble1, double paramDouble2)
  {
    return a(paramq, null, paramDouble1, paramDouble2);
  }
  
  public bb a(q paramq, e parame, double paramDouble1, double paramDouble2)
  {
    boolean bool = ld.E;
    if (!bool) {
      if (this.d == null) {
        return new bb();
      }
    }
    if (!bool) {
      if (this.q != null)
      {
        localObject = (g)this.q.j();
        ((g)localObject).b(paramDouble1, paramDouble2);
        return a(paramq, parame);
      }
    }
    Object localObject = (pg)j().e();
    Rectangle localRectangle = this.d.d();
    double d1 = paramDouble1 - localRectangle.x;
    double d2 = paramDouble2 - localRectangle.y;
    d1 = ((pg)localObject).w() * (int)(d1 / ((pg)localObject).w());
    d2 = ((pg)localObject).w() * (int)(d2 / ((pg)localObject).w());
    this.d.b(localRectangle.x + d1, localRectangle.y + d2);
    return a(paramq, parame);
  }
  
  public bb b(q paramq)
  {
    return a(paramq, null);
  }
  
  public bb a(q paramq, e parame)
  {
    boolean bool2 = ld.E;
    boolean bool1 = ld.D;
    if (!bool2) {
      if (this.d == null) {
        return new bb();
      }
    }
    j localj = j.a(paramq);
    if (parame == null) {
      return a(paramq, localj);
    }
    if (localj == null) {
      throw new IllegalStateException("No HierarchyManager associated to target graph.");
    }
    if (parame.g() != paramq) {
      throw new IllegalArgumentException("Target parent group does not belong to target graph.");
    }
    if (!localj.m(parame)) {
      throw new IllegalArgumentException("Target parent group not a group node.");
    }
    paramq.z();
    bb localbb;
    try
    {
      localbb = a(paramq, localj);
      b localb = null;
      Object localObject2;
      if ((paramq instanceof g))
      {
        localObject1 = new bb();
        localObject2 = parame;
        do
        {
          while (!bool1)
          {
            if (localObject2 == null) {
              break;
            }
            if (bool1) {
              break label191;
            }
            if (((e)localObject2).g() != paramq) {
              break;
            }
            ((bb)localObject1).add(localObject2);
            localObject2 = localj.p((e)localObject2);
          }
          ((g)paramq).a(((bb)localObject1).l());
        } while (bool2);
        label191:
        localb = ((g)paramq).w(parame).K();
        if ((bool2) || (localb != null)) {
          if (!bool2)
          {
            if (localb.e()) {
              localb.a(false);
            }
          }
          else {
            if (!bool1) {
              break label244;
            }
          }
        }
        localb = null;
      }
      label244:
      Object localObject1 = localj.f(paramq);
      if (localObject1 != parame)
      {
        localObject2 = localbb.l();
        do
        {
          if (!((a.c.w)localObject2).e()) {
            break;
          }
          e locale = ((a.c.w)localObject2).d();
          if (bool1) {
            break label350;
          }
          if ((bool2) || (localj.p(locale) == localObject1)) {
            localj.c(locale, parame);
          }
          ((a.c.w)localObject2).f();
        } while (!bool1);
      }
      if (!bool2) {
        if ((bool2) || (localb != null)) {
          localb.a(true);
        }
      }
    }
    finally
    {
      label350:
      paramq.A();
    }
    return localbb;
  }
  
  private bb a(q paramq, j paramj)
  {
    return a(this.d, paramq, this.d.v());
  }
  
  public byte f()
  {
    return this.r;
  }
  
  public void a(byte paramByte)
  {
    if (!ld.E) {}
    switch (paramByte)
    {
    case 0: 
    case 1: 
    case 2: 
      this.r = paramByte;
      if (!ld.D) {
        break;
      }
    default: 
      throw new IllegalArgumentException("Unsupported policy: " + paramByte);
    }
  }
  
  public Action g()
  {
    if (!ld.E) {
      if (this.j == null) {
        this.j = new e_();
      }
    }
    return this.j;
  }
  
  public Action h()
  {
    if (!ld.E) {
      if (this.h == null) {
        this.h = new g_();
      }
    }
    return this.h;
  }
  
  public Action i()
  {
    if (!ld.E) {
      if (this.i == null) {
        this.i = new f_();
      }
    }
    return this.i;
  }
  
  public void a(PropertyChangeListener paramPropertyChangeListener)
  {
    this.f.addPropertyChangeListener(paramPropertyChangeListener);
  }
  
  public void b(PropertyChangeListener paramPropertyChangeListener)
  {
    this.f.removePropertyChangeListener(paramPropertyChangeListener);
  }
  
  public df j()
  {
    return this.g;
  }
  
  protected e b(q paramq, e parame)
  {
    return a(paramq).a(paramq, parame);
  }
  
  protected d a(q paramq, e parame1, e parame2, d paramd)
  {
    return a(paramq).a(paramq, parame1, parame2, paramd);
  }
  
  a.d.w a(double paramDouble1, double paramDouble2)
  {
    if ((ld.E) || ((this.g.e() instanceof pg)))
    {
      pg localpg = (pg)this.g.e();
      return new a.d.w(paramDouble1 + localpg.w(), paramDouble2 + localpg.w());
    }
    return new a.d.w(paramDouble1 + 10.0D, paramDouble2 + 10.0D);
  }
  
  public void k()
  {
    boolean bool2 = ld.E;
    boolean bool1 = ke.e(e());
    if (!bool2)
    {
      if (bool1 != this.n) {
        this.n = bool1;
      }
    }
    else
    {
      if (!bool2) {}
      this.f.firePropertyChange("selectionEmpty", !bool1, bool1);
    }
  }
  
  void a(g paramg)
  {
    paramg.b(this.k);
    paramg.b(this.k);
  }
  
  void c(g paramg)
  {
    a(paramg);
    paramg.a(this.k);
    paramg.a(this.k);
    k();
  }
  
  void a(ze paramze)
  {
    if ((ld.E) || (paramze.d() != null)) {
      paramze.d().removePropertyChangeListener(this.l);
    }
    a(paramze.a());
  }
  
  void b(ze paramze)
  {
    a(paramze);
    if (!ld.E)
    {
      if (paramze.d() != null) {
        paramze.d().addPropertyChangeListener(this.l);
      }
      c(paramze.a());
    }
  }
  
  public boolean l()
  {
    return this.o;
  }
  
  public void a(boolean paramBoolean)
  {
    boolean bool = ld.E;
    if (!bool)
    {
      this.o = paramBoolean;
      if (!paramBoolean)
      {
        this.n = false;
        if (!bool) {}
        this.f.firePropertyChange("selectionEmpty", !this.n, this.n);
        if (bool) {
          break label84;
        }
        a(this.g.e());
        if (!ld.D) {
          return;
        }
      }
    }
    label84:
    b(this.g.e());
  }
  
  private final class e_
    extends AbstractAction
    implements PropertyChangeListener
  {
    e_()
    {
      super();
      if (!ld.E) {}
      setEnabled(!cc.this.d());
      cc.this.a(this);
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      g localg = cc.this.e();
      localg.z();
      cc.this.a(localg, localg.R());
      a.c.w localw = localg.R();
      if (localw.e()) {}
      do
      {
        localg.a(localw.d());
        localw.f();
        if ((!bool2) && (bool1)) {
          return;
        }
        if (!bool1) {
          break;
        }
        localg.A();
      } while (bool2);
      localg.gb();
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if (paramPropertyChangeEvent.getPropertyName().equals("selectionEmpty")) {
        setEnabled(paramPropertyChangeEvent.getNewValue().equals(Boolean.FALSE));
      }
    }
  }
  
  private final class f_
    extends AbstractAction
    implements PropertyChangeListener
  {
    f_()
    {
      super();
      if (!ld.E) {}
      setEnabled(!cc.this.c());
      cc.this.a(this);
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      boolean bool2 = ld.E;
      boolean bool1 = ld.D;
      g localg = cc.this.e();
      a.d.w localw = (a.d.w)getValue("PASTE_LOCATION");
      if ((bool2) || (localw == null)) {
        localw = new a.d.w();
      }
      if (!bool2) {
        if ((cc.this.g.e() instanceof pg))
        {
          pg localpg = (pg)cc.this.g.e();
          localObject1 = localpg.getVisibleRect();
          if (bool2) {
            break label141;
          }
          if (!((Rectangle)localObject1).contains(localw.a, localw.b)) {
            localw = new a.d.w(localpg.J().getX(), localpg.J().getY());
          }
        }
      }
      label141:
      int i = localg.k();
      Object localObject1 = null;
      Object localObject2 = getValue("PASTE_TARGET_GROUP_POLICY");
      if (!bool2) {
        if ((localObject2 instanceof Byte))
        {
          j = ((Byte)localObject2).byteValue();
          if (bool2) {
            break label198;
          }
          if (!bool1) {
            break label196;
          }
        }
      }
      int j = cc.this.f();
      label196:
      label198:
      if (!bool2) {}
      label319:
      label321:
      j localj;
      y localy;
      switch (j)
      {
      case 1: 
        if ((cc.this.g.e() instanceof pg))
        {
          if (bool2) {
            break label319;
          }
          localsc = new sc((pg)cc.this.g.e(), localw.a(), localw.b(), false, 4);
          if (!bool1) {
            break label321;
          }
        }
        sc localsc = new sc(localg, new nb().b(localg, 1), localw.a(), localw.b(), false);
        localj = localg.K();
        if ((localj != null) && ((bool2) || (localsc.x()))) {
          localy = localsc.e();
        }
        break;
      case 2: 
        while (localy.e())
        {
          Object localObject3 = (e)localy.j();
          if (!bool2)
          {
            if (localj.m((e)localObject3)) {
              localObject1 = localObject3;
            } else {
              localy.f();
            }
          }
          else if (bool1)
          {
            int k = 0;
            double d1 = (1.0D / 0.0D);
            localObject3 = localg.K();
            a.c.w localw2 = localg.R();
            label649:
            do
            {
              if (!localw2.e()) {
                break;
              }
              if (bool2) {
                break label693;
              }
              e locale = localw2.d();
              if (bool1) {
                break label689;
              }
              if (!bool2)
              {
                if (((j)localObject3).m(locale))
                {
                  ld localld = localg.w(locale);
                  if (!bool2) {
                    if (k != 0)
                    {
                      if (bool2) {
                        continue;
                      }
                      if (!localld.f(localw.a(), localw.b())) {
                        break label649;
                      }
                      d2 = localw.a(localld.A(), localld.B());
                      if (bool2) {
                        continue;
                      }
                      if (d1 <= d2) {
                        break label649;
                      }
                      d1 = d2;
                      localObject1 = locale;
                      if (bool2) {
                        continue;
                      }
                      if (!bool1) {
                        break label649;
                      }
                    }
                  }
                  if (!bool2)
                  {
                    if (localld.f(localw.a(), localw.b()))
                    {
                      d1 = localw.a(localld.A(), localld.B());
                      localObject1 = locale;
                      k = 1;
                    }
                  }
                  else
                  {
                    if (bool2) {
                      continue;
                    }
                    if (!bool1) {
                      break label649;
                    }
                  }
                  double d2 = localw.a(localld.A(), localld.B());
                  if (bool2) {
                    continue;
                  }
                  if (d1 > d2)
                  {
                    d1 = d2;
                    localObject1 = locale;
                  }
                }
                localw2.f();
              }
            } while (!bool1);
          }
        }
      }
      cc.this.a(localg, (e)localObject1, localw.a(), localw.b());
      if (!bool2) {
        localg.V();
      }
      label689:
      label693:
      a.c.w localw1 = localg.v();
      localw1.i();
      do
      {
        do
        {
          if (localg.k() <= i) {
            break;
          }
          localg.a(localw1.d(), true);
          localg.b(localw1.d().n(), true);
          i++;
          localw1.g();
          if ((!bool2) && (bool1)) {
            return;
          }
        } while (!bool1);
        putValue("PASTE_LOCATION", cc.this.a(localw.a, localw.b));
      } while (bool2);
      localg.gb();
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if (paramPropertyChangeEvent.getPropertyName().equals("empty"))
      {
        if (!ld.E) {}
        setEnabled(!cc.this.c());
      }
    }
  }
  
  private final class g_
    extends AbstractAction
    implements PropertyChangeListener
  {
    g_()
    {
      super();
      if (!ld.E) {}
      setEnabled(!cc.this.d());
      cc.this.a(this);
    }
    
    public void actionPerformed(ActionEvent paramActionEvent)
    {
      g localg = cc.this.e();
      localg.z();
      a.c.w localw = localg.R();
      cc.this.a(localg, localw);
      localw.h();
      Rectangle2D localRectangle2D = wc.a(localg, localw);
      cc.this.i().putValue("PASTE_LOCATION", cc.this.a(localRectangle2D.getX(), localRectangle2D.getY()));
      localg.A();
      localg.gb();
    }
    
    public void propertyChange(PropertyChangeEvent paramPropertyChangeEvent)
    {
      if (paramPropertyChangeEvent.getPropertyName().equals("selectionEmpty")) {
        setEnabled(paramPropertyChangeEvent.getNewValue().equals(Boolean.FALSE));
      }
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.cc

 * JD-Core Version:    0.7.0.1

 */